<?php
    class TrainningProgram {
        var $trnpId;
        var $trnpName;
        var $trnpStartDate;
        var $trainningItem;
        var $trainningClass;
        var $courseRelationship;

    function getTrnpId(){
        return $this->trnpId;
    }
    function setTrnpId($newTrnpId){
        $this->trnpId = $newTrnpId;
    }  
    function getTrnpName(){
        return $this->trnpName;
    }
     function setTrnpName($newTrnpName){
        $this->trnpName = $newTrnpName;
    }
     function getTrnpStartDate(){
        return $this->$trnpStartDate;
    }
    function setTrnpStartDate($newtrnpStartDate){
        $this->trnpStartDate = $newtrnpStartDate;
    } 
         
    function __construct(){}
    
     function getStudySemester($trnpID){
        $now = getdate();
        $yearnow = $now["year"];
        return ($yearnow-$trnpID)*2;
    }
    function addTrainningProgram($trnpid,$trnpname,$trnpdate){
        $sql = "INSERT INTO `trainningprogram` (TRNP_ID,TRNP_NAME,TRNP_START_DATE) VALUES('".$trnpid."','".$trnpname."','".$trnpdate."')";
        mysql_query($sql);
    }
    function editTrainningProgram($trnpid,$trnpname,$trnpdate){
        $sql = "UPDATE trainningprogram SET TRNP_NAME='".$trnpname."',TRNP_START_DATE='".$trnpdate."' WHERE TRNP_ID='".$trnpid."'";
        mysql_query($sql);
    }
    function deleteTrainningProgram($trnpid){
        $sql = "DELETE FROM trainningprogram WHERE TRNP_ID='".$trnpid."'";
        mysql_query($sql);
    }
    
}
?>